{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/components/Dialog/index.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport { DialogInput, UserStatus } from \"../\";\nimport { Context } from \"../../index\";\nimport { Messages } from \"../../containers\";\nimport { observer } from \"mobx-react-lite\";\nimport './Dialog.scss';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst Dialog = () => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const [chatId, setChatId] = React.useState(null);\n  const [chatName, setChatName] = React.useState(null);\n  React.useEffect(() => {\n    if (store.viewedDialogId) {\n      setChatId(store.viewedDialogId);\n    }\n  }, [store.viewedDialogId]);\n  React.useEffect(() => {\n    if (store.currentDialog) {\n      setChatName(store.currentDialog.name);\n    }\n  }, [store.currentDialog]);\n  return /*#__PURE__*/_jsxDEV(\"div\", {\n    className: \"messenger__dialog\",\n    children: [store.getViewedDialogId() && /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"messenger__dialog-header\",\n      children: [/*#__PURE__*/_jsxDEV(\"div\", {}, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 29,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__dialog-header-info\",\n        children: [/*#__PURE__*/_jsxDEV(\"p\", {\n          className: \"messenger__dialog-header-name\",\n          children: chatName && chatName\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 31,\n          columnNumber: 25\n        }, this), !store.currentDialog.multiChat && /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__dialog-header-status\",\n          children: /*#__PURE__*/_jsxDEV(UserStatus, {\n            status: true\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 34,\n            columnNumber: 33\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 33,\n          columnNumber: 29\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 30,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n        className: \"messenger__dialog-header-more\"\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 38,\n        columnNumber: 21\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 28,\n      columnNumber: 17\n    }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"messenger__dialog-messages\",\n      children: /*#__PURE__*/_jsxDEV(Messages, {}, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 42,\n        columnNumber: 17\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 41,\n      columnNumber: 13\n    }, this), store.getViewedDialogId() && /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"messenger__dialog-input\",\n      children: /*#__PURE__*/_jsxDEV(DialogInput, {\n        chatId: chatId && chatId\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 46,\n        columnNumber: 21\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 45,\n      columnNumber: 17\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 26,\n    columnNumber: 9\n  }, this);\n};\n_s(Dialog, \"YZQjfm9RUcoUrkFZlBOn6YZQHbc=\");\n_c = Dialog;\nexport default _c2 = observer(Dialog);\nvar _c, _c2;\n$RefreshReg$(_c, \"Dialog\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"names":["React","DialogInput","UserStatus","Context","Messages","observer","Dialog","store","useContext","chatId","setChatId","useState","chatName","setChatName","useEffect","viewedDialogId","currentDialog","name","getViewedDialogId","multiChat"],"sources":["/data/messenger.client/src/components/Dialog/index.tsx"],"sourcesContent":["import React from 'react';\nimport {DialogInput, UserStatus} from \"../\";\nimport {Context} from \"../../index\";\nimport {Messages} from \"../../containers\";\nimport {observer} from \"mobx-react-lite\";\nimport './Dialog.scss';\n\nconst Dialog = () => {\n    const {store} = React.useContext(Context);\n    const [chatId, setChatId] = React.useState<number | null>(null);\n    const [chatName, setChatName] = React.useState<string | null>(null);\n\n    React.useEffect(() => {\n        if (store.viewedDialogId!) {\n            setChatId(store.viewedDialogId);\n        }\n    }, [store.viewedDialogId]);\n\n    React.useEffect(() => {\n        if (store.currentDialog!) {\n            setChatName(store.currentDialog.name);\n        }\n    }, [store.currentDialog]);\n\n    return (\n        <div className=\"messenger__dialog\">\n            {store.getViewedDialogId()! && (\n                <div className=\"messenger__dialog-header\">\n                    <div/>\n                    <div className=\"messenger__dialog-header-info\">\n                        <p className=\"messenger__dialog-header-name\">{chatName! && chatName}</p>\n                        {!store.currentDialog.multiChat && (\n                            <div className=\"messenger__dialog-header-status\">\n                                <UserStatus status={true} />\n                            </div>\n                        )}\n                    </div>\n                    <button className=\"messenger__dialog-header-more\" />\n                </div>\n            )}\n            <div className=\"messenger__dialog-messages\">\n                <Messages />\n            </div>\n            {store.getViewedDialogId()! && (\n                <div className=\"messenger__dialog-input\">\n                    <DialogInput chatId={chatId! && chatId} />\n                </div>\n            )}\n        </div>\n    );\n}\n\nexport default observer(Dialog);"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,WAAW,EAAEC,UAAU,QAAO,KAAK;AAC3C,SAAQC,OAAO,QAAO,aAAa;AACnC,SAAQC,QAAQ,QAAO,kBAAkB;AACzC,SAAQC,QAAQ,QAAO,iBAAiB;AACxC,OAAO,eAAe;AAAC;AAEvB,MAAMC,MAAM,GAAG,MAAM;EAAA;EACjB,MAAM;IAACC;EAAK,CAAC,GAAGP,KAAK,CAACQ,UAAU,CAACL,OAAO,CAAC;EACzC,MAAM,CAACM,MAAM,EAAEC,SAAS,CAAC,GAAGV,KAAK,CAACW,QAAQ,CAAgB,IAAI,CAAC;EAC/D,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGb,KAAK,CAACW,QAAQ,CAAgB,IAAI,CAAC;EAEnEX,KAAK,CAACc,SAAS,CAAC,MAAM;IA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